import { Module } from '@nestjs/common'
import { UserController } from './user.controller'
import { UserService } from './user.service'
import { TypeOrmModule } from '@nestjs/typeorm'
import { User } from './entity/user.entity'
import { JwtModule } from '@nestjs/jwt'
import { JWtStrategy } from './jwt.strategy' // 策略文件

@Module({
  imports: [
    TypeOrmModule.forFeature([User]),
    JwtModule.register({
      secret: 'qwertasdfgzxcvb', // 秘钥
      signOptions: { expiresIn: '8h' }, // token 过期时效
    }),
  ],
  controllers: [UserController],
  providers: [UserService, JWtStrategy],
})
export class UserModule {}
